package org.wizehack.mri.fl;

public class Jaccard implements SFLAlgorithm {

	@Override
	public double getSuspiciousness(int totalPassed, int totalFailed,	int passed, int failed) {
		double suspiciousness = 0;
		double numerator = 0;
		
		if(totalFailed == 0){
			return 0;
		}
		else if(totalPassed == 0){
			return 1;
		}
		else{
			numerator = (double)totalFailed + (double)passed;
			if (numerator == 0){
				return 0;
			}
			else {
				suspiciousness = (double)failed / numerator;
			}
		}
		return suspiciousness;
	}

}
